package gui;


import java.util.ArrayList;
import java.util.List;

import javax.swing.*;

public class JOptionPaneMultiInput2 {

	List<JTextField> values;
	
	private static final int DEFAULT_COLUMNS = 5;
	
	public JOptionPaneMultiInput2(List<String> parameters, List<Double> defaultValues) 
	{
		
		values = new ArrayList<JTextField>();
		
		JPanel myPanel = new JPanel();
		myPanel.setLayout(new BoxLayout(myPanel, BoxLayout.Y_AXIS));
		myPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
		
		
		
		for(int i = 0; i <parameters.size();i++)
		{
			JTextField textField = new JTextField(Double.toString(defaultValues.get(i)), DEFAULT_COLUMNS);
			textField.setHorizontalAlignment(JTextField.CENTER);
			
			myPanel.add(new JLabel(parameters.get(i)));
			myPanel.add(textField);
			values.add(textField);
		}
		
		int result = JOptionPane.showConfirmDialog(null, myPanel, 
				"Please Enter Evolution Values", JOptionPane.OK_CANCEL_OPTION);
		
		if (result == JOptionPane.OK_OPTION) {
			
		}
		else{ System.exit(0); }



	}

	public double getParameterValue(int i) {
		return Double.parseDouble(values.get(i).getText());
	}
}